//
//  ExPhotoViewController.m
//  OC-Example
//
//  Created by apang on 2018/7/31.
//  Copyright © 2018年 apang.men All rights reserved.
//

#import "ExPhotoViewController.h"
#import <MobileCoreServices/MobileCoreServices.h>

@interface ExPhotoViewController ()

@end

@implementation ExPhotoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view setBackgroundColor:[UIColor whiteColor]];
    self.title = @"视频相册";

    UIButton * button = [UIButton buttonWithType:UIButtonTypeSystem];

    [button setTitle:@"AlassetsLibraryVC" forState:UIControlStateNormal];

    [button setTranslatesAutoresizingMaskIntoConstraints:NO];

    //    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

    [button addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];

    [self.view setBackgroundColor:[UIColor whiteColor]];

    [self.view addSubview:button];

    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0.0]];
    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0.0]];
}
- (void)btnAction:(UIButton *)sender {
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    //    imagePicker.delegate = self; 实现代理处理选择完成事件
    imagePicker.allowsEditing = YES;
    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePicker.mediaTypes =  [[NSArray alloc] initWithObjects: (__bridge NSString *) kUTTypeImage, nil];
    [self presentViewController:imagePicker animated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
